Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code being fixed in this commit does not use proper syntax to specify :pre conditions. As a result, when any of the predicate functions are provided with the
response
parameter that is not a map, instead of throwing an assertion error, execution reaches(:status response)
whereupon it producesNullPointerException
.This might cause confusion as to the origin of the error because the developer might not know or remember the proper syntax of the :pre conditions, and upon seeing that some code is present in the
:pre
header of the predicate functions they are using, they discard the possibility that it might be theresponse
parameter they are providing to these functions that causes an error, assuming that the predicate functions take care of validating the proper type of theresponse
parameter.Judging from the way
:pre
condition gets added to the function definition, current implementation uses the syntax which doesn't fail to operate only because theassert
function returnsnil
upon receiving a reference to a function and upon receiving the instance of the data type by itself, but the code does fail to fulfill its purpose, it doesn't really "work" as is.